Component({

    properties: {
        index: Number
    },

    data: {
        newIndex: '',
        months: [
            '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'
        ],
        year: 0,
        month: ''
    },

    observers: {
        'index' (index) {
            if (!index) {
                return
            }
            let newIndex = index < 10 ? '0' + index : index
            this.setData({
                newIndex
            })
        }
    },

    attached() {
        let date = new Date()
        let year = date.getFullYear()
        let month = date.getMonth()

        this.setData({
            year,
            month: this.data.months[month]
        })
    },

    methods: {

    }
})